parser grammar MyParser;

options { tokenVocab=MyLexer; }

@header {
package com.giteelou.antlr.ps;
}

pragma
    : statement*
    ;

statement
    : variableDeclaration
    | variableAssignment
    ;

variableDeclaration
    : primitiveType variableDeclarators ';'
    ;

variableDeclarators
    : variableDeclarator (',' variableDeclarator)*
    ;

variableDeclarator
    : variableDeclaratorId ('=' variableInitializer)?
    ;

variableDeclaratorId
    : IDENTIFIER
    ;

variableInitializer
    : literal
    ;

variableAssignment
    : variableDeclarator ';'
    ;

primitiveType
    : BOOLEAN
    | CHAR
    | BYTE
    | SHORT
    | INT
    | LONG
    | FLOAT
    | DOUBLE
    ;

literal
    : DECIMAL_LITERAL
    | FLOAT_LITERAL
    | CHAR_LITERAL
    | BOOL_LITERAL
    ;
